Skip to main content

All Questions

3votes
1answer
400views

What is the expected performance of While loops using `array.pop()` assignment vs other methods

Recently I was asked to refactor some code that leverages JavaScript's array.reduce() method because other developers felt the code hard to read. While doing this I decided to play around with some ...
Kenneth Moore's user avatar
9votes
2answers
11kviews

Is it good practice to use array.pop() assignment in a while loop condition?

Just saw a code snippet that used an array pop assignment in the while condition; was wondering if this is acceptable/good practice? var arr = [0,1,2,3,4,5]; var current; while (current = arr.pop()) {...
flewk's user avatar

close